by Rde (54 Submissions)
Category: Encryption
Compatability: VB 6.0
Difficulty: Advanced
Originally Published: Fri 12th August 2016
Date Added: Tue 9th February 2021
Rating: (1 Votes)
Hashed-keyMessageAuthenticationCodes(HMACs)HMACwasdevisedbyHugoKrawczykTheHMACmechanismisdescribedinRFC2104:Krawczyk,H.,Bellare,M.,andR.Canetti,"HMAC:Keyed-HashingforMessageAuthentication",RFC2104,February1997.AHash-basedMessageAuthenticationCodecanbeusedtodetermineifmessagessentoverinsecurechannelshavebeenmodified.Thisworksbyeachpartyatbothsendssharingasecretkeyusedtosignthesentmessageandtoalsoauthenticatethereceivedmessage.Ifthekeyiscompromised(nolongersecret)thentheauthenticationcannotbeguaranteed.HMACisusedformessageintegritychecksbetweentwopartiesthatshareasecretkey,andworksincombinationwithaSHA-2messagedigestalgorithm.HMACisamethodforcomputingakeyedMACusingaSHA-2hashfunction.Itusesakeytomixinwiththeinputdatatoproducethefinalmessagedigest.ThisclassmakesveryfastopensourcecodeperformingthethreemostusedSHA-2hashfunctions(256-384-512)availabletoanyOSon32-bitx86withrudimentarymmx.SinceSHA-2isdefinedintermsofanarbitrarynumberofbits,thisHMACcodehasbeenwrittentoallowthemessageinputtoHMACtohaveanarbitrarynumberofoctetsandbits.MoreinformationaboutHMACcanbefoundat:https://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf======================================================================================================================================================NowincludesoptionforFinalizetoalsoreturnthemessagebitlength.